<template>
  <div class="container">
    <div class="list">
      <div v-for="item in list" :key="item.id" class="cell">
        <router-link :to="`subject/list?id=${item.id}`">
          <img class="img" :src="item.image|imgPath" alt srcset>
        </router-link>
        <div class="text">
          <div class="title">{{item.name}}</div>
          <div class="date">{{item.createTime||"2019-3-8"}}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      list: []
    }
  },
  created () {
    this.getList()
  },
  methods: {
    getList (callback) {
      this.$axios.get('/xbkj-dj/web/subject/listAll').then(res => {
        this.list = res.data
      })
    }
  }
}
</script>
<style lang="less" scoped>
.list {
  padding: 20px;
  .cell {
    display: block;
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    .img {
      display: block;
      width: 100%;
      border-radius: 6px;
    }
    .text {
      display: flex;
      justify-content: space-between;
      align-items: center;
      line-height: 1;
      margin-top: 10px;
      .title {
        font-size: 14px;
      }
      .date {
        font-size: 12px;
        color: #ccc;
      }
    }
  }
}
</style>
